<template>
    <h1>添加会员</h1>
    <a href="/">返回列表</a>
    <table border="1">
        <tbody>
            <tr>
                <th>会员名称</th>
                <th>
                    <input type="text" v-model="data.Name">
                </th>
            </tr>
            <tr>
                <th>会员号</th>
                <th>
                    <input type="text" v-model="data.Num">
                </th>
            </tr>
            <tr>
                <th>电话</th>
                <th>
                    <input type="text" v-model="data.Phone">
                </th>
            </tr>
            <tr>
                <th>等级</th>
                <th>
                    <input type="text" v-model="data.Level">
                </th>
            </tr>
            <tr>
                <th>状态</th>
                <th>
                    <input v-model="data.State" type="radio"  name="State" value="启动" checked>启动
                    <input v-model="data.State" type="radio"  name="State" value="禁用" >禁用
                </th>
            </tr>
            <tr>
                <th>性别</th>
                <th>
                    <input v-model="data.Sex" type="radio"  name="Sex" value="1" checked>男
                    <input v-model="data.Sex" type="radio"  name="Sex" value="2" >女
                </th>
            </tr>
            <tr>
                <th>日期</th>
                <th>
                  <input type="date" v-model="data.Timess">
                </th>
            </tr>
            <tr>
                <th>
                    <input type="button" value="添加" @click="Add">
                </th>
                <th></th>
            </tr>
        </tbody>
    </table>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref } from 'vue';

const data=ref({
       "Id": 0,
    "Name": "",
    "Num": "",
    "Phone": "",
    "Level": "",
    "State": "",
    "Sex": 0,
    "Timess": ""
})

const Add=()=>{
    axios.post("https://localhost:7069/api/Member/MemberAdd",data.value).then(res=>{
        if(res.data>0){
            alert('添加成功')
            return;
        }
        else{
            alert('添加失败')
            return;
        }
    })
}



</script>

